package com.aia.prm.web.ria.app.ui.qnde;

import com.aia.prm.BeanFactory;
import com.aia.prm.domain.Qnde;
import com.aia.prm.service.DefaultService;
import com.aia.prm.web.ria.app.PrmApplication;
import com.vaadin.data.Property;
import com.vaadin.data.util.BeanItem;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
import com.vaadin.ui.PopupView;
import com.vaadin.ui.Table;

@SuppressWarnings("serial")
public class QndeList extends Table {
	PrmApplication app;
	QndeView view;
	DefaultService defaultService = (DefaultService) BeanFactory.get().getBean("defaultService");

	QndeList(PrmApplication aapp, QndeView aview) {
		app = aapp;
		view = aview;
		setSizeFull();

		setColumnCollapsingAllowed(true);
		setColumnReorderingAllowed(true);

		setSelectable(true);
		setImmediate(true);
		setMultiSelect(true);
		addListener((Property.ValueChangeListener) view);

//		addGeneratedColumn("more", new ColumnGenerator() {
//			public Component generateCell(Table source, Object itemId, Object columnId) {
//				BeanItem beanItem = (BeanItem) source.getItem(itemId);
//				Qnde bean = (Qnde) beanItem.getBean();
//
//				String template = defaultService.makeQndeTmplate(bean);
//
//				Label content = new Label(template);
//
//				content.setContentMode(Label.CONTENT_TEXT);
//
//				content.setWidth("500px");
//
//				PopupView popup = new PopupView("XML报文", content);
//				popup.setHideOnMouseOut(false);
//
//				return popup;
//			}
//		});
	}

}
